<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../../src/object/clone.js"></script>
</head>
<body>
  <script>
    const obj = { x: 'zjunbin', y: {m: 1} }

    const result = clone1(obj)
    // const result = clone2(obj)

    // 测试浅拷贝：修改新数据中某个引用类型的值
    result.y.m = 2

    console.log(obj);
    console.log(result);
    console.log(obj === result);
  </script>
</body>
</html>